package org.planaz.campusvoting.exception;

import lombok.extern.slf4j.Slf4j;
import org.planaz.campusvoting.common.result.Result;
import org.planaz.campusvoting.common.result.Results;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@Slf4j
@RestControllerAdvice
@Component
public class GlobalExceptionHandler {
    @ExceptionHandler({Exception.class})
    public Result<?> exceptionHandler(Exception e){
        return Results.failure("-1",e.getMessage());
    }

}
